package farmer.gui;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;

import farmer.game.Data;

public class BuildingButtonPopup{
	
	int type;
	
	public BuildingButtonPopup(int type){
		this.type = type;
	}
	
	
	public void draw(Graphics2D g){
		g.setColor(Color.white);
		g.fillRect(130, 430, 200, 150);
		g.setStroke(new BasicStroke(4));
		g.setColor(Color.darkGray);
		g.drawRect(130, 430, 200, 150);
		
		if(type == BuildingGUI.farmNum){
			drawFarm(g);
		}else if(type == BuildingGUI.windmillNum){
			drawMill(g);
		}else if(type == BuildingGUI.mineNum){
			drawMine(g);
		}else if(type == BuildingGUI.lumberjackNum){
			drawWood(g);
		}else if(type == BuildingGUI.roadNum){
			drawRoad(g);
		}else if(type == Data.tree){
			drawTree(g);
		}else if(type == Data.destroy){
			drawDestroy(g);
		}
	}
	
	private void drawFarm(Graphics2D g){
		//Draw title
		g.setColor(Color.black);
		g.setFont(new Font("Farm", Font.BOLD, 14));
		g.drawString("Farm", 140, 450);
		g.setFont(new Font("Hotkey", Font.PLAIN, 13));
		g.setColor(new Color(96, 194, 243));
		g.drawString("(Hotkey = 'F')", 200, 450);
		//Draw description
		g.setColor(Color.black);
		g.setFont(new Font("Description", Font.ITALIC, 13));
		g.drawString("The Farm produces the Food for", 140, 475);
		g.drawString("your population. To gather this", 140, 490);
		g.drawString("Food you need to build a Mill", 140, 505);
		g.drawString("near your farms.", 140, 520);
	}
	
	private void drawMill(Graphics2D g){
		//Draw title
		g.setColor(Color.black);
		g.setFont(new Font("Farm", Font.BOLD, 14));
		g.drawString("Mill", 140, 450);
		g.setFont(new Font("Hotkey", Font.PLAIN, 13));
		g.setColor(new Color(96, 194, 243));
		g.drawString("(Hotkey = 'M')", 200, 450);
		//Draw description
		g.setColor(Color.black);
		g.drawString("The Mill produce workers that ", 140, 475);
		g.drawString("recolt the Food from the Farm ", 140, 490);
		g.drawString("and bring it back to the Mill for", 140, 505);
		g.drawString("transformation. The transformed", 140, 520);
		g.drawString("Food can finally be transport to", 140, 535);
		g.drawString("the City for consommation", 140, 550);
	}
	
	private void drawMine(Graphics2D g){
		//Draw title
		g.setColor(Color.black);
		g.setFont(new Font("Farm", Font.BOLD, 14));
		g.drawString("Mine", 140, 450);
		g.setFont(new Font("Hotkey", Font.PLAIN, 13));
		g.setColor(new Color(96, 194, 243));
		g.drawString("(Hotkey = 'N')", 200, 450);
		//Draw description
		g.setColor(Color.black);
		g.drawString("The Mine produces the Rock for", 140, 475);
		g.drawString("your population. You need to ", 140, 490);
		g.drawString("bring the Rock back to the City", 140, 505);
		g.drawString("to use it", 140, 520);
	}
	
	private void drawWood(Graphics2D g){
		//Draw title
		g.setColor(Color.black);
		g.setFont(new Font("Farm", Font.BOLD, 14));
		g.drawString("Camp", 140, 450);
		g.setFont(new Font("Hotkey", Font.PLAIN, 13));
		g.setColor(new Color(96, 194, 243));
		g.drawString("(Hotkey = 'C')", 200, 450);
		//Draw description
		g.setColor(Color.black);
		g.drawString("The Camp produce workers that ", 140, 475);
		g.drawString("recolt the Wood from the Tree ", 140, 490);
		g.drawString("and bring it back to the Camp for", 140, 505);
		g.drawString("transformation. The transformed", 140, 520);
		g.drawString("Wood can finally be transport to", 140, 535);
		g.drawString("the City for consommation", 140, 550);
	}
	
	private void drawRoad(Graphics2D g){
		//Draw title
		g.setColor(Color.black);
		g.setFont(new Font("Farm", Font.BOLD, 14));
		g.drawString("Road", 140, 450);
		g.setFont(new Font("Hotkey", Font.PLAIN, 13));
		g.setColor(new Color(96, 194, 243));
		g.drawString("(Hotkey = 'R')", 200, 450);
		//Draw description
		g.setColor(Color.black);
		g.drawString("Transporter need to have a Road", 140, 475);
		g.drawString("between the City and a building", 140, 490);
		g.drawString("to transport the ressources of", 140, 505);
		g.drawString("that building back to the City.", 140, 520);
		g.drawString("Link the black dot together with", 140, 535);
		g.drawString("road to build a path for transporter.", 140, 550);
	}
	
	private void drawTree(Graphics2D g){
		//Draw title
		g.setColor(Color.black);
		g.setFont(new Font("Farm", Font.BOLD, 14));
		g.drawString("Tree", 140, 450);
		g.setFont(new Font("Hotkey", Font.PLAIN, 13));
		g.setColor(new Color(96, 194, 243));
		g.drawString("(Hotkey = 'T')", 200, 450);
		//Draw description
		g.setColor(Color.black);
		g.drawString("The Tree produces the Wood for", 140, 475);
		g.drawString("your population. To gather this", 140, 490);
		g.drawString("Wood you need to build a Camp", 140, 505);
		g.drawString("near the Trees.", 140, 520);
	}
	
	private void drawDestroy(Graphics2D g){
		//Draw title
		g.setColor(Color.black);
		g.setFont(new Font("Farm", Font.BOLD, 14));
		g.drawString("Destroy", 140, 450);
		g.setFont(new Font("Hotkey", Font.PLAIN, 13));
		g.setColor(new Color(96, 194, 243));
		g.drawString("(Hotkey = 'X')", 200, 450);
		//Draw description
		g.setColor(Color.black);
		g.drawString("To destroy a building or tree", 140, 475);
		g.drawString("select this button then click", 140, 490);
		g.drawString("on the building or tree that ", 140, 505);
		g.drawString("you want to destroy.", 140, 520);
	}
	

}
